package com.itheima.singleinstance;

public class Test1 {

    public static void main(String[] args) {

        //目标：设计单例类（例如任务管理器）
        /*A a1 = A.a;
        A a2 = A.a;
        System.out.println(a1);
        System.out.println(a2);
        System.out.println(a1 == a2);*/

        /*System.out.println();
        A.a = null;
        System.out.println(A.a);*/

        A a1 = A.getInstance();
        A a2 = A.getInstance();
        System.out.println(a1);
        System.out.println(a2);
        System.out.println(a1 == a2);

        System.out.println();

        B b1 = B.getInstance();
        B b2 = B.getInstance();
        System.out.println(b1);
        System.out.println(b2);
        System.out.println(b1 == b2);


    }
}
